package pers.amos.eshop;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import pers.amos.eshop.listener.InitListener;

/**
 * @author amos wong
 * @create 2020-11-14 11:46 上午
 */

@SpringBootApplication
@MapperScan("pers.amos.eshop.mapper")
public class EshopInventoryApplication {

    public static void main(String[] args) {
        SpringApplication.run(EshopInventoryApplication.class, args);
    }

    /**
     * 注册我们创建的InitListener监听器
     * @return
     */
    @Bean
    public ServletListenerRegistrationBean<InitListener> servletListenerRegistrationBean() {
        ServletListenerRegistrationBean<InitListener> servletListenerRegistrationBean =
                new ServletListenerRegistrationBean<>();
        servletListenerRegistrationBean.setListener(new InitListener());
        return servletListenerRegistrationBean;
    }

/*    @Bean
    public JedisCluster jedisCluster() {
        Set<HostAndPort> jedisClusterNodes = new HashSet<>();
        jedisClusterNodes.add(new HostAndPort("127.0.0.1", 6379));
        JedisCluster jedisCluster = new JedisCluster(jedisClusterNodes);
        return jedisCluster;
    }*/

}
